<?php
namespace PsiFramework\Applications\AlloMediaPortal\Classes\Model;

import("Classes.Model.Object");

use \PsiFramework\Classes\Model\Object;

/**
 * AlloMedia
 * Portail des professionnels
 *
 * @author Rémi San
 * @version beta
 */

/**
 * Classe d'un formulaire d'informations
 *
 * @package Model
 */
class InformationProfile extends Object
{

    protected /*int*/                $_id ;
    protected /*string*/             $_name ;
    protected /*string*/             $_text ;
    protected /*Date*/               $_creationDate;
    protected /*Date*/               $_modificationDate;
    protected /*InformationPart[]*/  $_parts ;
    protected /*SiteCategory[]*/     $_categories ;

    /**
     * Constructeur
     *
     * @param  int                $id                L'identifiant du formulaire
     * @param  string             $name              Le nom du formulaire
     * @param  string             $text              Le texte de la categorie
     * @param  Date               $creationDate      La date de création
     * @param  Date               $modificationDate  La date de modification
     * @param  InformationPart[]  $parts             Les parties du formulaire
     */
    public function __construct(
        /*int*/ $id=null,
        /*string*/ $name=null,
        /*string*/ $text=null,
        /*Date*/ $creationDate=null,
        /*Date*/ $modificationDate=null,
        /*InformationPart[]*/ $parts=null,
        /*SiteCategory[]*/ $categories=null
    )
    {
        $this->_id = $id ;
        $this->_name = $name ;
        $this->_text = $text ;
        $this->_creationDate = $creationDate    ;
        $this->_modificationDate = $modificationDate ;
        $this->_parts = $parts ;
        $this->_categories = $categories ;
    }

    public function getId()
    {
        return $this->_id ;
    }

    public function setId($id)
    {
        $this->_id = $id ;
    }

    public function getName()
    {
        return $this->_name ;
    }

    public function setName($name)
    {
        $this->_name = $name ;
    }

    public function getText()
    {
        return $this->_text ;
    }

    public function setText($text)
    {
        $this->_text = $text ;
    }

    public function getCreationDate()
    {
        return $this->_creationDate ;
    }

    public function setCreationDate($creationDate)
    {
        $this->_creationDate = $creationDate ;
    }

    public function getModificationDate()
    {
        return $this->_modificationDate ;
    }

    public function setModificationDate($modificationDate)
    {
        $this->_modificationDate = $modificationDate ;
    }

    public function sortParts()
    {
        if (!is_null($this->_parts)) {
        	ksort($this->_parts);
        }
        return $this->_parts ;
    }

    public function getParts()
    {
    	$this->sortParts();
    	return $this->_parts ;
    }

    public function setParts($parts)
    {
        $this->_parts = $parts ;
        $this->sortParts();
    }

    public function getCategories()
    {
        return $this->_categories ;
    }

    public function setCategories($categories)
    {
        $this->_categories = $categories ;
    }

    public function toString()
    {
        return $this->_name ;
    }
}
